package com.homegoods.videomodule.presenter;

import com.homegoods.classify.model.Constant;
import com.homegoods.videomodule.model.LiveShowModel;
import com.kedll.library.mvp.AbstractRefreshPresenter;
import com.kedll.library.mvp.RefreshingView;

import io.reactivex.Observable;

/**
 * @author QiQi
 * @description 免费社区Presenter层
 */
public class LiveShowPresenter extends AbstractRefreshPresenter {
    public LiveShowPresenter(RefreshingView view) {
        super(view);
    }

    @Override
    protected void fetchData(boolean isLoadMore) {
        addSubscription(Observable.range(0, 10)
                .map(integer -> {
                    LiveShowModel model = new LiveShowModel();
                    model.setTitle("宅品直营店");
                    model.setShower("大鹏嘚吧");
                    model.setPopularity(String.valueOf(Constant.random.nextInt(100000)));
                    model.setImgUrl(Constant.TEST_AD_URL + Constant.random.nextInt());
                    model.setVideoUrl("rtmp://live.myzpzy.com/AppName/StreamName?auth_key=1540776388-0-0-e5d4a42ccb797729484ec7660ddb91ef");
                    model.setId(String.valueOf(page * PER_PAGE_COUNT + integer));
                    return model;
                })
                .toList()
                .subscribe(baseItems -> parserData(isLoadMore, baseItems))
        );
    }

}